<template>

</template>
<script setup lang="ts">
import { onMounted } from 'vue';
import { getUrlKey } from '../../utils/common'
import { useUserInfo } from '../../stores/userInfo'
import { useUserConfig } from '../../stores/userConfig'
import eventBus from '../../utils/event-bus';
const userInfo = useUserInfo() //获取用户信息
const userConfig = useUserConfig() //获取用户信息
import {
    qqCodelogin
} from "../../api/home/index";
import router from '../../router';
onMounted(()=>{
    const code = (getUrlKey('code'));
    const state = (getUrlKey('state'));
    qqCodelogin({state:state,code:code}).then((res:any)=>{
        if (res.code == 1) {
            userInfo.dataFill(res.data.userInfo)
            userConfig.setVipClass(res.data.vipClass)
            userConfig.setPayType(res.data.payType)
            userConfig.setCoinType(res.data.coinType)
            router.push(res.data.routePath)
            eventBus.emit('customEvent', {
                dis: false
            })
        }
    })
})
</script>